<?php
/**
 *
 */
namespace app\index\model;
use app\index\model\BaseModel;
use think\Db;
use think\Model;

class UserModel extends Model
{
    protected $pk = 'id';

    protected $table = 'cq_user';

    public static function getUserByPhone($phone,$field = '*')
    {
        $user = Db::name('user')
            ->where('phone', $phone)
            ->field($field)
            ->find();
       return $user;
    }

    public static function addUser($data)
    {
        $user = new UserModel();
        $user->user_no = $data['user_no'];
        $user->phone = $data['phone'];
        $user->password_salt = $data['password_salt'];
        $user->password = $data['password'];
        $user->status = $data['status'];
        $user->is_auth = $data['is_auth'];
        $user->rolo_id = $data['rolo_id'];
        $user->created_at = $data['created_at'];
        $user->updated_at = $data['updated_at'];
        $num = $user->save(); dd($num);
    }

}